package com.malamute.system.service.impl;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.malamute.core.common.Page;
import com.malamute.system.dao.RoleDao;
import com.malamute.system.entity.Role;
import com.malamute.system.service.RoleService;

/**
 * @author Aceguan
 * @description TODO
 * @date 2012-2-27 下午10:40:39
 * @version v1.0
 */
@Service
public class RoleServiceImpl implements RoleService {
	@Autowired
	private RoleDao roleDao;

	/*
	 * (non-Javadoc)
	 * 
	 * @param role
	 * 
	 * @see
	 * com.malamute.system.service.RoleService#saveRole(com.malamute.system.
	 * entity.Role)
	 */
	@Override
	public void saveRole(Role role) {
		roleDao.save(role);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @param role
	 * 
	 * @see
	 * com.malamute.system.service.RoleService#updateRole(com.malamute.system
	 * .entity.Role)
	 */
	@Override
	public void updateRole(Role role) {
		roleDao.update(role);

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @param id
	 * 
	 * @return
	 * 
	 * @see
	 * com.malamute.system.service.RoleService#getRoleById(java.lang.Integer)
	 */
	@Override
	public Role getRoleById(Integer id) {
		return roleDao.get(id);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @param id
	 * 
	 * @see
	 * com.malamute.system.service.RoleService#deleteRoleById(java.lang.Integer)
	 */
	@Override
	public void deleteRoleById(Integer id) {
		roleDao.deleteByKey(id);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @param criteria
	 * 
	 * @param page
	 * 
	 * @see
	 * com.malamute.system.service.RoleService#listRolesByPage(org.hibernate
	 * .criterion.DetachedCriteria, com.malamute.core.common.Page)
	 */
	@Override
	public void listRolesByPage(DetachedCriteria criteria, Page page) {
		roleDao.listByPage(criteria, page);
	}

}
